// 例子14

{
    const x = 1, y = 1;
    function minus(x, y) {
        return x - y;
    }
    console.log(`x = ${x}, y = ${y}, x + y = ${x + y}, x - y = ${minus(x, y)}`);
    // "x = 1, y = 1, x + y = 2, x - y = 0"
}

console.log('----------------------------------')

{
    const items = [
        {
            id: 1,
            name: 'Tom'
        },
        {
            id: 2,
            name: 'Jerry'
        }
    ]
    let html = `
        <div class="user-list">
            <ul>
                ${items.map((value, key) => {`
                    ${console.log(key, value)}
                    <li data-id="${value.id}">${value.name}</li>
                `}).join('')}
            </ul>
        </div>
    `;

    console.log(`html=${html}`)

    try {
        $('#result').append(html);
    } catch(e) {
        console.error(e)
    }

    // html的值为：
    //"
    //<div class="user-list">
    //	<ul>
    //
    //			<li data-id="1">Tom</li>
    //
    //			<li data-id="2">Jerry</li>
    //
    //	</ul>
    //</div>
    //"
    // 打印结果为：
    // 0 {id: 1, name: "Tom"}
    // 1 {id: 2, name: "Jerry"}
}